﻿<%@ Page Title="Admin Opret Bruger" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="adminUsersCreate.aspx.cs" Inherits="UCNKompetenceBors.Admin.adminCreateUser" Culture="auto" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript">
        function Hide() {
            document.getElementById('<%=lblConfirmCreatedUser.ClientID %>').style.display = 'none';
            return false;
        }
    </script>

    <div id="adminWrapper" class="contentSmallWrapper floatLeft">
        <div id="adminSubMenuBox" class="submenuBox floatLeft">
            <div class="subMenuBoxContent">
                <ul>
                    <li>
                        <asp:HyperLink ID="hyLinkAdminDashboard" runat="server" Text="Admin Dashboard"></asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="hyLinkUserHandling" runat="server" Text="Brugerhåndtering"></asp:HyperLink>
                        <ul>
                            <li>
                                <asp:HyperLink ID="hyLinkCreateUser" runat="server" Text="Opret Bruger" ForeColor="#FF9933"></asp:HyperLink>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <asp:HyperLink ID="hyLinkAdminExchange" runat="server" Text="Køb og Salg"></asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="hyLinkNewsHandling" runat="server" Text="Nyhedshåndtering"></asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="hyLinkEditInformation" runat="server" Text="Ret Information"></asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="hyLinkContactPerson" runat="server" Text="kontaktpersoner"></asp:HyperLink></li>
                    <li><asp:HyperLink ID="hylinkDepartment" runat="server" Text="Afdelinger"></asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="hyLinkResetUsers" runat="server" Text="Reset Brugere"></asp:HyperLink></li>
                </ul>
            </div>
        </div>

        <div id="adminContentBox" class="contentBoxSmall floatLeft">
            <div id="adminContentBoxContent">
                <div class="inputFormSmall floatLeft">
                    <asp:Panel ID="panCreateUserForm" runat="server">
                        <div class="inputFormSmallLeft floatLeft">
                            <div class="inputFormSmallRow floatLeft">
                                <asp:Label ID="lblCreateUserHeader" runat="server" Text="Opret en Bruger" CssClass="contentTitle"></asp:Label>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblUserName" runat="server" Text="Brugernavn: " AssociatedControlID="txtUserName"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtUserName" runat="server" Width="300px" MaxLength="100"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvalUserName" runat="server" ErrorMessage="User Name is required" ToolTip="User Name is required" Text="*" ControlToValidate="txtUserName" ValidationGroup="CreateUserForm" ForeColor="Red"></asp:RequiredFieldValidator>
                                    <asp:CustomValidator ID="cusvalUserName" runat="server" ErrorMessage="Det valgte brugernavn er allerede i brug" ToolTip="Det valgte brugernavn er allerede i brug." ControlToValidate="txtUserName" ValidationGroup="CreateUserForm" Text="*" ForeColor="Red" Display="Dynamic" OnServerValidate="cusvalUserName_ServerValidate"></asp:CustomValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblUserRole" runat="server" Text="Rolle: " AssociatedControlID="ddlUserRole"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:DropDownList ID="ddlUserRole" runat="server" Width="300px">
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="rfvalUserRole" runat="server" ErrorMessage="Rolle skal vælges" ToolTip="Rolle skal vælges" Text="*" ControlToValidate="ddlUserRole" InitialValue="Vælg Rolle" ValidationGroup="CreateUserForm" ForeColor="Red"></asp:RequiredFieldValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblPassword" runat="server" Text="Password: " AssociatedControlID="txtPassword"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtPassword" runat="server" Width="300px" MaxLength="100" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvalPassword" runat="server" ErrorMessage="Password skal udfyldes" ToolTip="Password skal udfyldes" Text="*" ControlToValidate="txtPassword" ValidationGroup="CreateUserForm" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="regexvalPasswordStrength" runat="server" ErrorMessage="Password skal være mindst 8 karakterer langt" ToolTip="Password skal være mindst 8 karakterer langt" ValidationGroup="CreateUserForm" ValidationExpression="(\s*(\S)\s*){8,}" ControlToValidate="txtPassword" Text="*" ForeColor="Red" Display="Dynamic"></asp:RegularExpressionValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblConfirmPassword" runat="server" Text="Bekræft Password: " AssociatedControlID="txtPassword"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtConfirmPassword" runat="server" Width="300px" MaxLength="100" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvalConfirmPassword" runat="server" ErrorMessage="Bekræft Password skal udfyldes" ToolTip="Bekræft Password skal udfyldes" Text="*" ControlToValidate="txtConfirmPassword" ValidationGroup="CreateUserForm" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
                                    <asp:CompareValidator ID="compvalConfirmPassword" runat="server" ErrorMessage="Passwords matcher ikke" ToolTip="Passwords matcher ikke" Text="*" ForeColor="Red" ControlToValidate="txtConfirmPassword" ControlToCompare="txtPassword" Display="Dynamic"></asp:CompareValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblEmail" runat="server" Text="E-mail: " AssociatedControlID="txtEmail"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtEmail" runat="server" Width="300px" MaxLength="100"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvalEmail" runat="server" ErrorMessage="E-mail skal udfyldes" ToolTip="E-mail skal udfyldes" Text="*" ControlToValidate="txtEmail" ValidationGroup="CreateUserForm" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="regexvalEmail" runat="server" ErrorMessage="Den valgte E-mail er ugyldig" ValidationExpression="^.+@[^\.].*\.[a-z]{2,}$" ControlToValidate="txtEmail" ValidationGroup="CreateUserForm" ToolTip="Den valgte E-mail er ugyldig" Display="Dynamic" Text="*" ForeColor="Red"></asp:RegularExpressionValidator>
                                    <asp:CustomValidator ID="cusvalEmail" runat="server" ErrorMessage="The Email that you entered already exists" ToolTip="The Email that you entered Email already exists" ControlToValidate="txtEmail" ValidationGroup="CreateUserForm" Text="*" ForeColor="Red" Display="Dynamic" OnServerValidate="cusvalEmail_ServerValidate"></asp:CustomValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <asp:Label ID="lblAdditionalInfo" runat="server" Text="Ekstra Information" CssClass="contentTitle"></asp:Label>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblFirstName" runat="server" Text="Fornavn: " AssociatedControlID="txtFirstName"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtFirstName" runat="server" Width="300px" MaxLength="50"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvalFirstName" runat="server" ErrorMessage="Fornavn skal udfyldes" ToolTip="Fornavn skal udfyldes" Text="*" ControlToValidate="txtFirstName" ValidationGroup="CreateUserForm" ForeColor="Red"></asp:RequiredFieldValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblLastName" runat="server" Text="Efternavn: " AssociatedControlID="txtLastName"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtLastName" runat="server" Width="300px" MaxLength="50"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvalLastName" runat="server" ErrorMessage="Efternavn skal udfyldes" ToolTip="Efternavn skal udfyldes" Text="*" ControlToValidate="txtLastName" ValidationGroup="CreateUserForm" ForeColor="Red"></asp:RequiredFieldValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="inputFormSmallCellLeft floatLeft">
                                    <asp:Label ID="lblPhone" runat="server" Text="Telefon (Valgfri): " AssociatedControlID="txtPhone"></asp:Label>
                                </div>
                                <div class="inputFormSmallCellRight floatLeft">
                                    <asp:TextBox ID="txtPhone" runat="server" Width="300px" MaxLength="15"></asp:TextBox>
                                    <asp:RegularExpressionValidator ID="regexvalPhone" runat="server" ErrorMessage="Det valgte telefonnummer er ugyldigt" ToolTip="Det valgte telefonnummer er ugyldigt" ValidationGroup="CreateUserForm" ValidationExpression="^((\(?\+45\)?)?)(\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2})$" ControlToValidate="txtPhone" Text="*" ForeColor="Red" Display="Dynamic"></asp:RegularExpressionValidator>
                                </div>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <asp:Label ID="lblBiography" runat="server" Text="Bio (Valgfri): "></asp:Label>
                                <br />
                                <br />
                                <CKEditor:CKEditorControl ID="ckeditorBiography" BasePath="/ckeditor/" runat="server"></CKEditor:CKEditorControl>
                            </div>

                            <div class="inputFormSmallRow floatLeft">
                                <div class="floatLeft">
                                    <asp:Label ID="lblConfirmCreatedUser" runat="server"></asp:Label>
                                </div>
                                <div class="inputFormButtonMargin floatRight">
                                    <asp:Button ID="btnCreateUser" runat="server" Text="Create User" ValidationGroup="CreateUserForm" CssClass="button" OnClientClick="Hide()" OnClick="btnCreateUser_Click" />
                                </div>
                            </div>
                        </div>
                        <div class="inputFormSmallRight floatRight">
                            <asp:ValidationSummary ID="valsumSignupForm" runat="server" ForeColor="Red" HeaderText="De følgende fejl blev fundet:" ValidationGroup="CreateUserForm" />
                        </div>
                    </asp:Panel>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
